﻿using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 纺织贸易管理系统;

namespace PrintLabel.View
{
    public partial class SelectStockname : Form
    {
        public string StockName { get; set; } =  string.Empty;
        public SelectStockname()
        {
            InitializeComponent();
        }

        private void SelectStockname_Load(object sender, EventArgs e)
        {
            CreateStockBtn();
        }
        private void CreateStockBtn()
        {
            var stocknames = dbContext.dbcontext.Queryable<StockInfoTable>().ToList();
            foreach (var item in stocknames)
            {
                var btn = new UIButton() { Width = 100, Height = 60 };
                btn.Text = item.mingcheng ;
                btn.Click += Btn_Click;
                flowLayoutPanel1.Controls.Add(btn);
            }
        }
        private void Btn_Click(object sender, EventArgs e)
        {
            var btn = sender as UIButton;
            this.StockName = btn.Text;
            this.Close();
        }
    }
}
